<template>
    <div>
        <table class="wq text-center" border="0" cellpadding="0" cellspacing="1">
            <tr class="t_list_caption">
                <td v-for="(item,index) in 10" :key="index" :colspan="index == 1 || index == 3 ? 2 : 1"><label class="flexbox"><input type="radio" name="radiotype" :value="index" v-model="continuousData.radioopt" @change="radioChange"></label></td>
            </tr>
            <tr class="t_td_text">
                <td>二全中</td>
                <td colspan="2">二中特</td>
                <td>三全中</td>
                <td colspan="2">三中二</td>
                <td>特串</td>
                <td>四全中</td>
                <td>选二连组</td>
                <td>选三连组</td>
                <td>选三前组</td>
                <td>选四前组</td>
            </tr>
            <tr class="t_td_text">
                <td class="colorRed bolds">{{ratedata['连码:二全中:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:二中特:中二']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:二中特:中特']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:三全中:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:三中二:中二']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:三中二:中三']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:特串:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:四全中:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:选二连组:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:选三连组:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:选三前组:$fn']}}</td>
                <td class="colorRed bolds">{{ratedata['连码:选四前组:$fn']}}</td>
            </tr>
        </table>
        <table class="wq text-center" border="0" cellpadding="0" cellspacing="1">
            <tr class="t_list_caption">
                <td colspan="10">号码</td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b01"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['01']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['01']"></label></td>
                <td><span class="b11"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['11']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9  && !moneydata['11']"></label></td>
                <td><span class="b21"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['21']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['21']"></label></td>
                <td><span class="b31"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['31']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['31']"></label></td>
                <td><span class="b41"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['41']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['41']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b02"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['02']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['02']"></label></td>
                <td><span class="b12"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['12']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['12']"></label></td>
                <td><span class="b22"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['22']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['22']"></label></td>
                <td><span class="b32"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['32']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['32']"></label></td>
                <td><span class="b42"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['42']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['42']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b03"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['03']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['03']"></label></td>
                <td><span class="b13"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['13']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['13']"></label></td>
                <td><span class="b23"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['23']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['23']"></label></td>
                <td><span class="b33"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['33']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['33']"></label></td>
                <td><span class="b43"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['43']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['43']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b04"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['04']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['04']"></label></td>
                <td><span class="b14"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['14']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['14']"></label></td>
                <td><span class="b24"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['24']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['24']"></label></td>
                <td><span class="b34"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['34']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['34']"></label></td>
                <td><span class="b44"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['44']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['44']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b05"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['05']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['05']"></label></td>
                <td><span class="b15"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['15']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['15']"></label></td>
                <td><span class="b25"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['25']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['25']"></label></td>
                <td><span class="b35"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['35']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['35']"></label></td>
                <td><span class="b45"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['45']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['45']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b06"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['06']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['06']"></label></td>
                <td><span class="b16"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['16']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['16']"></label></td>
                <td><span class="b26"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['26']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['26']"></label></td>
                <td><span class="b36"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['36']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['36']"></label></td>
                <td><span class="b46"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['46']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['46']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b07"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['07']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['07']"></label></td>
                <td><span class="b17"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['17']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['17']"></label></td>
                <td><span class="b27"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['27']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['27']"></label></td>
                <td><span class="b37"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['37']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['37']"></label></td>
                <td><span class="b47"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['47']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['47']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b08"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['08']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['08']"></label></td>
                <td><span class="b18"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['18']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['18']"></label></td>
                <td><span class="b28"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['28']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['28']"></label></td>
                <td><span class="b38"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['38']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['38']"></label></td>
                <td><span class="b48"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['48']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['48']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b09"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['09']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['09']"></label></td>
                <td><span class="b19"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['19']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['19']"></label></td>
                <td><span class="b29"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['29']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['29']"></label></td>
                <td><span class="b39"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['39']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['39']"></label></td>
                <td><span class="b49"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['49']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['49']"></label></td>
            </tr>
            <tr class="t_td_text">
                <td><span class="b10"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['10']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['10']"></label></td>
                <td><span class="b20"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['20']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['20']"></label></td>
                <td><span class="b30"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['30']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['30']"></label></td>
                <td><span class="b40"></span></td>
                <td><label class="flexbox"><input type="checkbox" name="checkboxtype" v-model="moneydata['40']" @change="checkboxChange" :disabled="continuousData.betArr.length > 9 && !moneydata['40']"></label></td>
                <td colspan="2"></td>
            </tr>
            
        </table>

    </div>
    
    
</template>
<style scoped>
    input[name='radiotype'],input[name='checkboxtype']{
        margin: 3px auto;
    }
</style>

<script>

    var timer = null;
    
    import axios from 'axios'
    import {lotterytype} from '../../../../assets/js/lotterytype.js'
    export default {
        name: "LhcLma",
        props: {  //普通类型：String、Number、Boolean、Null    引用类型： Array、Object
            betmoney: {   //   下注金额
                type: String,
                required: true
            },
            openBet: {  //开奖  可下注
                type: Boolean,
                required: true
            },
            ninetime: {  //90s
                type: Number,
                required: true
            },
        },
        data(){
            return{
                ratedata: {},  //实时赔率
                params: {},  //菜单
                moneydata: {},  //是否下注
                continuousData: {
                    betArr: [],  //下注数组
                    radioopt: 0,  //当前类别
                    betnowtype: 0,  //当前类别 赔率
                },
                
            }
        },
        methods: {
            init(){

                var _this = this;

                this.params = lotterytype.apiParams(this.$route.query.id,this.$route.query.levelid);

                
                if(window.localStorage.Authorization){
                    
                    _this.$httpGet('/api/game/listRate/'+ _this.params.nowlottery + '/' + _this.params.levellottery +'oa18').then(response => {
                        
                        if(response.status == 200){
                            _this.ratedata = response.data.rates;
                            _this.continuousData.betnowtype = response.data.rates['连码:二全中:$fn'];
                            _this.$emit('contBetFun',_this.continuousData);

                            if(response.data.need){
                                _this.$httpPost('/api/setting/rateItem/'+ _this.params.nowlottery + '/' + _this.params.levellottery +'oa18').then(response => {
                                
                                    if(response.status == 200){
                                        
                                    }

                                });
                            }
                        }

                    });

                }
            },
            inits(){

                var _this = this;

                this.params = lotterytype.apiParams(this.$route.query.id,this.$route.query.levelid);

                
                if(window.localStorage.Authorization){

                    if (timer) {
                        clearInterval(timer);
                        timer = null;
                    }

                    _this.$httpGet('/api/game/listRate/'+ _this.params.nowlottery + '/' + _this.params.levellottery +'oa18').then(response => {
                        
                        if(response.status == 200){
                            _this.ratedata = response.data.rates;
                            _this.continuousData.betnowtype = response.data.rates['连码:二全中:$fn'];
                            _this.$emit('contBetFun',_this.continuousData);

                            if(response.data.need){
                                _this.$httpPost('/api/setting/rateItem/'+ _this.params.nowlottery + '/' + _this.params.levellottery +'oa18').then(response => {
                                
                                    if(response.status == 200){
                                        
                                    }

                                });
                            }

                            timer = setInterval(() => {
                                _this.inits();
                            }, 10 * 1000)
                        }

                    });

                }
            },
            //切换类别
            radioChange(){

                if(this.continuousData.radioopt == 0){  //二全中
                    this.continuousData.betnowtype = this.ratedata['连码:二全中:$fn'];
                }else if(this.continuousData.radioopt == 1){  //二中特
                    this.continuousData.betnowtype = this.ratedata['连码:二中特:中二'] + '  /  ' + this.ratedata['连码:二中特:中特'];
                }else if(this.continuousData.radioopt == 2){  //三全中
                    this.continuousData.betnowtype = this.ratedata['连码:三全中:$fn'];
                }else if(this.continuousData.radioopt == 3){  //三中二
                    this.continuousData.betnowtype = this.ratedata['连码:三中二:中二'] + '  /  ' + this.ratedata['连码:三中二:中三'];
                }else if(this.continuousData.radioopt == 4){  //特串
                    this.continuousData.betnowtype = this.ratedata['连码:特串:$fn'];
                }else if(this.continuousData.radioopt == 5){  //四全中
                    this.continuousData.betnowtype = this.ratedata['连码:四全中:$fn'];
                }else if(this.continuousData.radioopt == 6){  //选二连组
                    this.continuousData.betnowtype = this.ratedata['连码:选二连组:$fn'];
                }else if(this.continuousData.radioopt == 7){  //选三连组
                    this.continuousData.betnowtype = this.ratedata['连码:选三连组:$fn'];
                }else if(this.continuousData.radioopt == 8){  //选三前组
                    this.continuousData.betnowtype = this.ratedata['连码:选三前组:$fn'];
                }else if(this.continuousData.radioopt == 9){  //选四前组
                    this.continuousData.betnowtype = this.ratedata['连码:选四前组:$fn'];
                }

                this.moneydata = {};
                this.continuousData.betArr = [];
                console.log(this.moneydata);
                this.$emit('contBetFun',this.continuousData);

            },
            //
            checkboxChange(item){

                this.continuousData.betArr = [];

                for (var index in this.moneydata){

                    if(this.moneydata[index]){
                        this.continuousData.betArr.push(index);
                    }

                }
                console.log(this.continuousData);
                this.$emit('contBetFun',this.continuousData);

            },
            
        },
        mounted(){
            this.inits();
        },
        beforeDestroy(){
            clearInterval(timer);
        },
        watch :{
            openBet: function(now,old){
                console.log(now,old);
                this.init();
            },
            ninetime: function(now,old){
                console.log('------------90s  刷新');
                //90s  刷新数据
                this.init();
            },
        },
    }
</script>
